package com.bestv.c2.main;

import com.bestv.c2.task.DumpDataTask;
import com.bestv.c2.task.SyncDataTask;
import com.bestv.c2.task.Task;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

/**
 * Created by Henry on 15/9/2.
 */
public class DateExportService {
    public static void main(String[] args) {
        ApplicationContext context = new FileSystemXmlApplicationContext("config/applicationContext.xml");
        if (args.length > 0) {
            String job = args[0];
            if ("dump".equals(job)) {
                Task dumpDataTask = (DumpDataTask) context.getBean("dumpDataTask");
                dumpDataTask.execute();
            } else if ("sync".equals(job)) {
                Task syncDataTask = (SyncDataTask) context.getBean("syncDataTask");
                syncDataTask.execute();
            }
            System.exit(0);
        }
    }
}
